package com.le.tester.webpage.redis.service;

import com.le.tester.delay.BaseDelayed;
import com.le.tester.delay.OnDelayedListener;
import org.springframework.beans.factory.InitializingBean;

/**
 * 描述：内存队列的接口
 */
public interface DelayedService extends InitializingBean {

    //往队列中放东西
    void add(BaseDelayed<?> baseDelayed);

    //根据key获取延时队列中的信息
    <T extends BaseDelayed, K> T getDelayed(Class<T> clazz, K key);

    //从延时队列中删除
    <T, D extends BaseDelayed<?>> D remove(Class<T> clazz, T value);

    //监听注册
    <T extends BaseDelayed<?>> void registerListen(Class<T> clazz, OnDelayedListener<T> listener);
}
